﻿using Rong.EasyExcel.Attributes;

namespace Simple.Services.System.Office.Model
{
    public class ImportExcelResultModel<TImportDto> where TImportDto : ImportModel
    {
        /// <summary>
        /// 是否成功
        /// </summary>
        public bool IsSuccess { get; set; } = false;

        /// <summary>
        /// 有效数据
        /// </summary>
        public List<TImportDto>? ValidList { get; set; }

        /// <summary>
        /// 无效数据（包含了每条无效数据的错误内容）
        /// </summary>
        public List<TImportDto>? InvalidList { get; set; }

        /// <summary>
        /// 错误消息
        /// </summary>
        public string? Error { get; set; }
    }

    public abstract class ImportModel
    {
        [IgnoreColumn]
        public virtual string? Error { get; set; }

        [IgnoreColumn]
        public virtual int RowNumber { get; set; }

        [IgnoreColumn]
        public virtual bool IsSuccess => string.IsNullOrWhiteSpace(Error);
    }
}
